﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Starfire3d.Interfaces;

namespace Starfire3d.Data
{
    public class GameObject
    {
        private IDataContainer gameData = null;
        private Guid id;

        public string Entity_Name = ""; // Placeholder

        public GameObject()
        {
        }

        public IDataContainer Data
        {
            get { return gameData; }
        }

        public Guid Id
        {
            get { return id; }
            set { id = value; }
        }

        protected void CreateDataStore()
        {
            if (gameData == null)
                gameData = new DataContainer();
        }

        public virtual bool Update()
        {
            return false;
        }

        public int DistanceTo(GameObject other)
        {
            if (this.Data == null || other.Data == null)
                return -1;

            int dx = Math.Abs(this.Data.GetInt("X") - other.Data.GetInt("X"));
            int dy = Math.Abs(this.Data.GetInt("Y") - other.Data.GetInt("Y"));

            return Math.Max(dx, dy);
        }
    }
}
